
<!DOCTYPE HTML>
<html lang="zh-hans" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>3.2.4.2 使用协处理器写入被叫信息 · 大数据 bigdata_telecom_project_atguigu 课堂笔记</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content=" 李振超">
        
        
    
    <link rel="stylesheet" href="../../../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../../../gitbook/gitbook-plugin-splitter/splitter.css">
                
            
                
                <link rel="stylesheet" href="../../../gitbook/gitbook-plugin-expandable-chapters-small/expandable-chapters-small.css">
                
            
                
                <link rel="stylesheet" href="../../../gitbook/gitbook-plugin-page-toc-button/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../../gitbook/gitbook-plugin-prism/prism-solarizedlight.css">
                
            
                
                <link rel="stylesheet" href="../../../gitbook/gitbook-plugin-tbfed-pagefooter/footer.css">
                
            
                
                <link rel="stylesheet" href="../../../gitbook/gitbook-plugin-change_girls/girls.css">
                
            
                
                <link rel="stylesheet" href="../../../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../../../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
        <link rel="stylesheet" href="../../../styles/website.css">
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../../../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="../325-ba-zheng-ge-xiao-fei-mo-kuai-da-bao-dao-ji-qun-zhong-yun-xing.html" />
    
    
    <link rel="prev" href="3241-shou-dong-cha-ru-bei-jiao-xin-xi.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入并搜索" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    
    
        
        <li>
            <a href="http://www.atguigu.com/" target="_blank" class="custom-link">联系我们</a>
        </li>
    
    

    
    <li class="divider"></li>
    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../../../">
            
                <a href="../../../">
            
                    
                    第 1 章 项目背景
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../../../chapter1.html">
            
                <a href="../../../chapter1.html">
            
                    
                    第 2 章 项目架构
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../../../di-3-zhang-xiang-shi-xian.html">
            
                <a href="../../../di-3-zhang-xiang-shi-xian.html">
            
                    
                    第 3 章 项目实现
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../../31-shu-ju-sheng-cheng.html">
            
                <a href="../../31-shu-ju-sheng-cheng.html">
            
                    
                    3.1 数据生产模块
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="../../32-shu-ju-cai-ji-he-xiao-fei.html">
            
                <a href="../../32-shu-ju-cai-ji-he-xiao-fei.html">
            
                    
                    3.2 数据采集和消费
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.2.1" data-path="../321-shu-ju-cai-ji.html">
            
                <a href="../321-shu-ju-cai-ji.html">
            
                    
                    3.2.1 数据采集
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2.2" data-path="../322-shu-ju-xiao-fei.html">
            
                <a href="../322-shu-ju-xiao-fei.html">
            
                    
                    3.2.2 数据消费
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.2.2.1" data-path="../322-shu-ju-xiao-fei/3221-7c7b3a-propertyutil.html">
            
                <a href="../322-shu-ju-xiao-fei/3221-7c7b3a-propertyutil.html">
            
                    
                    3.2.2.1 类:PropertyUtil
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2.2.2" data-path="../322-shu-ju-xiao-fei/3222-7c7b3ahbasedao.html">
            
                <a href="../322-shu-ju-xiao-fei/3222-7c7b3ahbasedao.html">
            
                    
                    3.2.2.2 类: HBaseDao
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2.2.3" data-path="../322-shu-ju-xiao-fei/3223-7c7b3ahbaseutil.html">
            
                <a href="../322-shu-ju-xiao-fei/3223-7c7b3ahbaseutil.html">
            
                    
                    3.2.2.3 类: HBaseUtil
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2.2.4" data-path="../322-shu-ju-xiao-fei/3224-7c7b3ahbaseconsumer.html">
            
                <a href="../322-shu-ju-xiao-fei/3224-7c7b3ahbaseconsumer.html">
            
                    
                    3.2.2.4 类: HBaseConsumer
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3.2.3" data-path="../323-shu-ju-cha-xun-fang-shi-1.html">
            
                <a href="../323-shu-ju-cha-xun-fang-shi-1.html">
            
                    
                    3.2.3 数据查询方式1
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.2.3.1" data-path="../323-shu-ju-cha-xun-fang-shi-1/3231-hbasefilterutil.html">
            
                <a href="../323-shu-ju-cha-xun-fang-shi-1/3231-hbasefilterutil.html">
            
                    
                    3.2.3.1 类: HBaseFilterUtil
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2.3.2" data-path="../323-shu-ju-cha-xun-fang-shi-1/3232-7c7b3a-querywithfilter.html">
            
                <a href="../323-shu-ju-cha-xun-fang-shi-1/3232-7c7b3a-querywithfilter.html">
            
                    
                    3.2.3.2 类: QueryWithFilter
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3.2.4" data-path="../323-shu-ju-cha-xun-fang-shi-2.html">
            
                <a href="../323-shu-ju-cha-xun-fang-shi-2.html">
            
                    
                    3.2.4 数据查询方式2
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.2.4.1" data-path="3241-shou-dong-cha-ru-bei-jiao-xin-xi.html">
            
                <a href="3241-shou-dong-cha-ru-bei-jiao-xin-xi.html">
            
                    
                    3.2.4.1 手动写入被叫信息
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.3.2.4.2" data-path="3242-shi-yong-xie-chu-li-qi-xie-ru-bei-jiao-xin-xi.html">
            
                <a href="3242-shi-yong-xie-chu-li-qi-xie-ru-bei-jiao-xin-xi.html">
            
                    
                    3.2.4.2 使用协处理器写入被叫信息
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3.2.5" data-path="../325-ba-zheng-ge-xiao-fei-mo-kuai-da-bao-dao-ji-qun-zhong-yun-xing.html">
            
                <a href="../325-ba-zheng-ge-xiao-fei-mo-kuai-da-bao-dao-ji-qun-zhong-yun-xing.html">
            
                    
                    3.2.5 把整个消费模块打包到集群中运行
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="../../33-shu-ju-fen-xi.html">
            
                <a href="../../33-shu-ju-fen-xi.html">
            
                    
                    3.3 数据分析
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.3.1" data-path="../../33-shu-ju-fen-xi/331-xu-qiu-fen-xi.html">
            
                <a href="../../33-shu-ju-fen-xi/331-xu-qiu-fen-xi.html">
            
                    
                    3.3.1 数据分析
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3.2" data-path="../../33-shu-ju-fen-xi/332-mysql-biao-jie-gou-she-ji.html">
            
                <a href="../../33-shu-ju-fen-xi/332-mysql-biao-jie-gou-she-ji.html">
            
                    
                    3.3.2 Mysql 表结构设计
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3.3" data-path="../../33-shu-ju-fen-xi/333-huan-jing-da-jian.html">
            
                <a href="../../33-shu-ju-fen-xi/333-huan-jing-da-jian.html">
            
                    
                    3.3.3 环境搭建
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3.4" data-path="../../33-shu-ju-fen-xi/334-xu-qiu-shi-xian.html">
            
                <a href="../../33-shu-ju-fen-xi/334-xu-qiu-shi-xian.html">
            
                    
                    3.3.4 需求实现
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.3.4.1" data-path="../../33-shu-ju-fen-xi/334-xu-qiu-shi-xian/3341-53053a-com-atguigu-dataanalasis-bean.html">
            
                <a href="../../33-shu-ju-fen-xi/334-xu-qiu-shi-xian/3341-53053a-com-atguigu-dataanalasis-bean.html">
            
                    
                    3.3.4.1 包: com.atguigu.dataanalasis.bean
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3.4.2" data-path="../../33-shu-ju-fen-xi/334-xu-qiu-shi-xian/3342-53053a-com-atguigu-dataanalasis-conversion.html">
            
                <a href="../../33-shu-ju-fen-xi/334-xu-qiu-shi-xian/3342-53053a-com-atguigu-dataanalasis-conversion.html">
            
                    
                    3.3.4.2 包: com.atguigu.dataanalasis.conversion
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3.4.3" data-path="../../33-shu-ju-fen-xi/334-xu-qiu-shi-xian/3343-53053a-com-atguigu-dataanalasis-mapred.html">
            
                <a href="../../33-shu-ju-fen-xi/334-xu-qiu-shi-xian/3343-53053a-com-atguigu-dataanalasis-mapred.html">
            
                    
                    3.3.4.3 包:com.atguigu.dataanalasis.mapred
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3.4.4" data-path="../../33-shu-ju-fen-xi/334-xu-qiu-shi-xian/3344-53053a-com-atguigu-dataanalasis-outputformat.html">
            
                <a href="../../33-shu-ju-fen-xi/334-xu-qiu-shi-xian/3344-53053a-com-atguigu-dataanalasis-outputformat.html">
            
                    
                    3.3.4.4 包:com.atguigu.dataanalasis.outputformat
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3.4.5" data-path="../../33-shu-ju-fen-xi/334-xu-qiu-shi-xian/3345-53053a-com-atguigu-dataanalasis-util.html">
            
                <a href="../../33-shu-ju-fen-xi/334-xu-qiu-shi-xian/3345-53053a-com-atguigu-dataanalasis-util.html">
            
                    
                    3.3.4.5 包: com.atguigu.dataanalasis.util
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3.3.5" data-path="../../33-shu-ju-fen-xi/335-yun-xing-ce-shi.html">
            
                <a href="../../33-shu-ju-fen-xi/335-yun-xing-ce-shi.html">
            
                    
                    3.3.5 运行测试
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3.4" data-path="../../34-shu-ju-zhan-shi.html">
            
                <a href="../../34-shu-ju-zhan-shi.html">
            
                    
                    3.4 数据展示
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            本书使用 GitBook 发布
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../../.." >3.2.4.2 使用协处理器写入被叫信息</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="3242-&#x4F7F;&#x7528;&#x534F;&#x5904;&#x7406;&#x5668;&#x5199;&#x5165;&#x88AB;&#x53EB;&#x4FE1;&#x606F;">3.2.4.2 &#x4F7F;&#x7528;&#x534F;&#x5904;&#x7406;&#x5668;&#x5199;&#x5165;&#x88AB;&#x53EB;&#x4FE1;&#x606F;</h1>
<p>&#x6211;&#x4EEC;&#x8FD8;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x534F;&#x5904;&#x7406;&#x7684;&#x65B9;&#x5F0F;&#x6765;&#x5199;&#x5165;&#x88AB;&#x53EB;&#x4FE1;&#x606F;.</p>
<p>&#x5728; HBase &#x4E2D;&#x7C7B;&#x4F3C;&#x5173;&#x7CFB;&#x6570;&#x636E;&#x5E93;&#x4E2D;&#x7684;&#x5B58;&#x50A8;&#x8FC7;&#x7A0B;&#x548C;&#x89E6;&#x53D1;&#x5668;&#x7684;&#x529F;&#x80FD;&#xFF0C; </p>
<p>&#x5B83;&#x53EB;&#x534F;&#x5904;&#x7406;&#x5668;&#xFF08;<code>coprocessor</code>&#xFF09;</p>
<hr>
<p>&#x5728; 0.92 &#x4E4B;&#x524D;&#xFF0C;HBase &#x8FD8;&#x6CA1;&#x6709;&#x534F;&#x5904;&#x7406;&#x5668;&#xFF0C;&#x90A3;&#x4E2A;&#x65F6;&#x5019;&#x5C31;&#x7B97;&#x7B80;&#x5355;&#x7684;&#x7EDF;&#x8BA1;&#x8868;&#x6709;&#x591A;&#x5C11;&#x884C;&#x7684;&#x4EFB;&#x52A1;&#x90FD;&#x9700;&#x8981;&#x5C06;&#x670D;&#x52A1;&#x7AEF;&#x7684;&#x6570;&#x636E;&#x5168;&#x90E8;&#x53D6;&#x51FA;&#x6765;&#x6328;&#x4E2A;&#x5730;&#x5728;&#x5BA2;&#x6237;&#x7AEF;&#x8FDB;&#x884C;&#x7EDF;&#x8BA1;&#xFF0C;&#x53EF;&#x4EE5;&#x60F3;&#x8C61;&#x8FD9;&#x6837;&#x505A;&#x7684;&#x6027;&#x80FD;&#x4E4B;&#x4F4E;&#x4E0B;&#x3002;</p>
<p>&#x6240;&#x4EE5;&#x5728; 0.92 &#x4E4B;&#x540E; HBase &#x52A0;&#x5165;&#x4E86;&#x534F; &#x5904;&#x7406;&#x5668;&#xFF0C;&#x4EE5;&#x4FBF;&#x4E8E;&#x7528;&#x6237;&#x53EF;&#x4EE5;&#x6269;&#x5C55;&#x670D;&#x52A1;&#x7AEF;&#x7684;&#x7C7B;&#x5E93;&#xFF0C;&#x5E76;&#x76F4;&#x63A5;&#x5728;&#x670D;&#x52A1;&#x7AEF;&#x5B8C;&#x6210;&#x7279;&#x5B9A;&#x4EFB;&#x52A1;&#x800C;&#x4E0D;&#x9700;&#x8981;&#x8DDF;&#x5BA2;&#x6237;&#x7AEF;&#x4E4B;&#x95F4;&#x6709; IO &#x64CD;&#x4F5C;&#x3002;</p>
<hr>
<p><img src="http://lizhenchao.oss-cn-shenzhen.aliyuncs.com/1543150665.png-atguiguText" alt=""></p>
<hr>
<p>&#x534F;&#x5904;&#x7406;&#x5668;&#x662F;&#x8FD0;&#x884C;&#x5728;&#x670D;&#x52A1;&#x7AEF;&#x7684;&#x7A0B;&#x5E8F;.</p>
<hr>
<p>&#x7531;&#x4E8E;&#x534F;&#x5904;&#x7406;&#x662F;&#x8FD0;&#x884C;&#x5728;&#x670D;&#x52A1;&#x5668;&#x7AEF;&#x7684;, &#x6240;&#x4EE5;&#x9700;&#x8981;&#x6DFB;&#x52A0;&#x4F9D;&#x8D56;:</p>
<pre class="language-"><code class="lang-xml"><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>dependency</span><span class="token punctuation">&gt;</span></span>
    <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>groupId</span><span class="token punctuation">&gt;</span></span>org.apache.hbase<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>groupId</span><span class="token punctuation">&gt;</span></span>
    <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>artifactId</span><span class="token punctuation">&gt;</span></span>hbase-server<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>artifactId</span><span class="token punctuation">&gt;</span></span>
    <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>version</span><span class="token punctuation">&gt;</span></span>1.3.2.1<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>version</span><span class="token punctuation">&gt;</span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>dependency</span><span class="token punctuation">&gt;</span></span>
</code></pre>
<p>&#x5982;&#x679C;&#x5DF2;&#x7ECF;&#x6DFB;&#x52A0;, &#x5C31;&#x5FFD;&#x7565;.</p>
<h2 id="1-&#x521B;&#x5EFA;&#x534F;&#x5904;&#x7406;&#x5668;&#x7C7B;-calleewriteobserver">1. &#x521B;&#x5EFA;&#x534F;&#x5904;&#x7406;&#x5668;&#x7C7B;: <code>CalleeWriteObserver</code></h2>
<pre class="language-"><code class="lang-java"><span class="token keyword">package</span> com<span class="token punctuation">.</span>atguigu<span class="token punctuation">.</span>dataconsumer<span class="token punctuation">.</span>coprocessor<span class="token punctuation">;</span>

<span class="token keyword">import</span> com<span class="token punctuation">.</span>atguigu<span class="token punctuation">.</span>dataconsumer<span class="token punctuation">.</span>HBaseDao<span class="token punctuation">;</span>
<span class="token keyword">import</span> org<span class="token punctuation">.</span>apache<span class="token punctuation">.</span>hadoop<span class="token punctuation">.</span>hbase<span class="token punctuation">.</span>client<span class="token punctuation">.</span>Durability<span class="token punctuation">;</span>
<span class="token keyword">import</span> org<span class="token punctuation">.</span>apache<span class="token punctuation">.</span>hadoop<span class="token punctuation">.</span>hbase<span class="token punctuation">.</span>client<span class="token punctuation">.</span>Put<span class="token punctuation">;</span>
<span class="token keyword">import</span> org<span class="token punctuation">.</span>apache<span class="token punctuation">.</span>hadoop<span class="token punctuation">.</span>hbase<span class="token punctuation">.</span>coprocessor<span class="token punctuation">.</span>BaseRegionObserver<span class="token punctuation">;</span>
<span class="token keyword">import</span> org<span class="token punctuation">.</span>apache<span class="token punctuation">.</span>hadoop<span class="token punctuation">.</span>hbase<span class="token punctuation">.</span>coprocessor<span class="token punctuation">.</span>ObserverContext<span class="token punctuation">;</span>
<span class="token keyword">import</span> org<span class="token punctuation">.</span>apache<span class="token punctuation">.</span>hadoop<span class="token punctuation">.</span>hbase<span class="token punctuation">.</span>coprocessor<span class="token punctuation">.</span>RegionCoprocessorEnvironment<span class="token punctuation">;</span>
<span class="token keyword">import</span> org<span class="token punctuation">.</span>apache<span class="token punctuation">.</span>hadoop<span class="token punctuation">.</span>hbase<span class="token punctuation">.</span>regionserver<span class="token punctuation">.</span>wal<span class="token punctuation">.</span>WALEdit<span class="token punctuation">;</span>
<span class="token keyword">import</span> org<span class="token punctuation">.</span>apache<span class="token punctuation">.</span>hadoop<span class="token punctuation">.</span>hbase<span class="token punctuation">.</span>util<span class="token punctuation">.</span>Bytes<span class="token punctuation">;</span>

<span class="token keyword">import</span> java<span class="token punctuation">.</span>io<span class="token punctuation">.</span>IOException<span class="token punctuation">;</span>

<span class="token keyword">public</span> <span class="token keyword">class</span> <span class="token class-name">CalleeWriteObserver</span> <span class="token keyword">extends</span> <span class="token class-name">BaseRegionObserver</span> <span class="token punctuation">{</span>
    <span class="token comment">// &#x521B;&#x5EFA; HBaseDao &#x5BF9;&#x8C61;</span>
    <span class="token keyword">private</span> HBaseDao hBaseDao <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">HBaseDao</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

    <span class="token comment">/**
     * &#x8986;&#x5199; postPut &#x65B9;&#x6CD5;, put &#x65B9;&#x6CD5;&#x6267;&#x884C;&#x5B8C;&#x6BD5;&#x4E4B;&#x540E;&#x6267;&#x884C;&#x6B64;&#x65B9;&#x6CD5;
     * &lt;p&gt;
     * &#x5F53;&#x63D2;&#x5165;&#x4E00;&#x6761;&#x4E3B;&#x53EB;&#x8BB0;&#x5F55;&#x4E4B;&#x540E;, &#x518D;&#x8FD9;&#x91CC;&#x518D;&#x63D2;&#x5165;&#x4E00;&#x6761;&#x88AB;&#x53EB;&#x8BB0;&#x5F55;
     * &lt;p&gt;
     * &#x7531;&#x4E8E;&#x63D2;&#x5165;&#x88AB;&#x53EB;&#x4FE1;&#x606F;&#x4E5F;&#x662F;&#x4F1A;&#x6267;&#x884C; put &#x65B9;&#x6CD5;, &#x6240;&#x4EE5;&#x4F1A;&#x518D;&#x6B21;&#x51FA;&#x53D1;&#x8FD9;&#x4E2A;&#x65B9;&#x6CD5;, &#x4E00;&#x5B9A;&#x8981;&#x9632;&#x6B62;&#x6B7B;&#x5FAA;&#x73AF;.
     *
     * @param e
     * @param put
     * @param edit
     * @param durability
     * @throws IOException
     */</span>
    <span class="token annotation punctuation">@Override</span>
    <span class="token keyword">public</span> <span class="token keyword">void</span> <span class="token function">postPut</span><span class="token punctuation">(</span>ObserverContext<span class="token generics function"><span class="token punctuation">&lt;</span>RegionCoprocessorEnvironment<span class="token punctuation">&gt;</span></span> e<span class="token punctuation">,</span> Put put<span class="token punctuation">,</span> WALEdit edit<span class="token punctuation">,</span> Durability durability<span class="token punctuation">)</span> <span class="token keyword">throws</span> IOException <span class="token punctuation">{</span>
        <span class="token comment">// &#x63D2;&#x5165;&#x4E3B;&#x53EB;&#x6570;&#x636E;&#x65F6;&#x7684;&#x884C;  0000_16480981069_2018-02-24 04:59:34_19877232369_1600_0</span>
        String row <span class="token operator">=</span> Bytes<span class="token punctuation">.</span><span class="token function">toString</span><span class="token punctuation">(</span>put<span class="token punctuation">.</span><span class="token function">getRow</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

        <span class="token comment">// &#x7EC4;&#x88C5;&#x6210;&#x8FD9;&#x6837;&#x7684;&#x5B57;&#x7B26;&#x4E32; 19877232369,2018-02-24 04:59:34,16480981069,1600,1</span>
        String<span class="token punctuation">[</span><span class="token punctuation">]</span> split <span class="token operator">=</span> row<span class="token punctuation">.</span><span class="token function">split</span><span class="token punctuation">(</span><span class="token string">&quot;_&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token string">&quot;1&quot;</span><span class="token punctuation">.</span><span class="token function">equals</span><span class="token punctuation">(</span>split<span class="token punctuation">[</span><span class="token number">5</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">)</span> <span class="token keyword">return</span><span class="token punctuation">;</span>  <span class="token comment">// &#x5982;&#x679C;&#x63D2;&#x5165;&#x7684;&#x662F;&#x88AB;&#x53EB;&#x4FE1;&#x606F;, &#x5219;&#x76F4;&#x63A5;&#x8FD4;&#x56DE;&#x4E0D;&#x505A;&#x4EFB;&#x4F55;&#x64CD;&#x4F5C;.</span>

        String value <span class="token operator">=</span> split<span class="token punctuation">[</span><span class="token number">3</span><span class="token punctuation">]</span> <span class="token operator">+</span> <span class="token string">&quot;,&quot;</span> <span class="token operator">+</span> split<span class="token punctuation">[</span><span class="token number">2</span><span class="token punctuation">]</span> <span class="token operator">+</span> <span class="token string">&quot;,&quot;</span> <span class="token operator">+</span> split<span class="token punctuation">[</span><span class="token number">1</span><span class="token punctuation">]</span> <span class="token operator">+</span> <span class="token string">&quot;,&quot;</span> <span class="token operator">+</span> split<span class="token punctuation">[</span><span class="token number">4</span><span class="token punctuation">]</span> <span class="token operator">+</span> <span class="token string">&quot;,1&quot;</span><span class="token punctuation">;</span>
        hBaseDao<span class="token punctuation">.</span><span class="token function">put</span><span class="token punctuation">(</span>value<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre>
<hr>
<h2 id="2-&#x5982;&#x4F55;&#x52A0;&#x8F7D;&#x534F;&#x5904;&#x7406;">2. &#x5982;&#x4F55;&#x52A0;&#x8F7D;&#x534F;&#x5904;&#x7406;</h2>
<p>&#x52A0;&#x8F7D;&#x534F;&#x5904;&#x7406;&#x7684;&#x65B9;&#x5F0F;&#x4E00;&#x822C;&#x6709; 3 &#x79CD;:</p>
<ol>
<li><p>&#x901A;&#x8FC7; API &#x7684;&#x65B9;&#x5F0F;&#x52A0;&#x8F7D;</p>
<p> &#x9488;&#x5BF9;&#x67D0;&#x4E2A;&#x8868;</p>
</li>
<li><p>&#x914D;&#x7F6E;&#x6587;&#x4EF6;<code>hive-site.xml</code>&#x52A0;&#x8F7D;</p>
<p> &#x9488;&#x5BF9;&#x6240;&#x6709;&#x8868;</p>
</li>
<li><p>shell &#x7684;&#x65B9;&#x5F0F;&#x52A0;&#x8F7D;</p>
</li>
</ol>
<p>&#x524D;&#x4E24;&#x79CD;&#x6BD4;&#x8F83;&#x5E38;&#x7528;, &#x7B2C;&#x4E09;&#x79CD;&#x4E0D;&#x5E38;&#x7528;.</p>
<h2 id="3-&#x901A;&#x8FC7;-api-&#x7684;&#x65B9;&#x5F0F;&#x52A0;&#x8F7D;&#x534F;&#x5904;&#x7406;&#x5668;">3. &#x901A;&#x8FC7; API &#x7684;&#x65B9;&#x5F0F;&#x52A0;&#x8F7D;&#x534F;&#x5904;&#x7406;&#x5668;</h2>
<p>&#x4ECA;&#x5929;&#x6211;&#x4EEC;&#x9009;&#x62E9;&#x4F7F;&#x7528; API &#x7684;&#x65B9;&#x5F0F;&#x6765;&#x52A0;&#x8F7D;&#x534F;&#x5904;&#x7406;&#x5668;.</p>
<p>&#x9700;&#x8981;&#x91CD;&#x65B0;&#x521B;&#x5EFA;&#x8868;, &#x5E76;&#x5728;&#x8868;&#x63CF;&#x8FF0;&#x5668;&#x4E2D;&#x6765;&#x6CE8;&#x518C;&#x534F;&#x5904;&#x7406;&#x5668;.</p>
<p>&#x9700;&#x8981;&#x5148;&#x5220;&#x9664;&#x539F;&#x6765;&#x7684;&#x8868;(&#x4F7F;&#x7528; shell &#x624B;&#x52A8;&#x5220;&#x9664;&#x5373;&#x53EF;)</p>
<pre class="language-"><code class="lang-java">desc<span class="token punctuation">.</span><span class="token function">addCoprocessor</span><span class="token punctuation">(</span><span class="token string">&quot;com.atguigu.dataconsumer.coprocessor.CalleeWriteObserver&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre>
<h2 id="4-&#x628A;&#x5305;&#x542B;&#x534F;&#x5904;&#x7406;&#x7684;&#x9879;&#x76EE;&#x6253;-jar-&#x5305;&#x4E4B;&#x540E;-&#x653E;&#x5165;-hbasehomelib-&#x76EE;&#x5F55;&#x4E0B;">4. &#x628A;&#x5305;&#x542B;&#x534F;&#x5904;&#x7406;&#x7684;&#x9879;&#x76EE;&#x6253; jar &#x5305;&#x4E4B;&#x540E;, &#x653E;&#x5165; <code>$HBASE_HOME/lib</code> &#x76EE;&#x5F55;&#x4E0B;</h2>
<p>&#x6CE8;&#x610F;&#x9700;&#x8981;&#x5206;&#x53D1;&#x5230;&#x96C6;&#x7FA4;&#x4E2D;&#x7684;&#x6BCF;&#x4E2A; RegionServer &#x4E2D;.</p>
<h2 id="5-&#x91CD;&#x542F;-hbase-&#x670D;&#x52A1;&#x5668;">5. &#x91CD;&#x542F; HBase &#x670D;&#x52A1;&#x5668;</h2>
<h2 id="7-&#x542F;&#x52A8;&#x6D88;&#x8D39;&#x8005;-&#x5F00;&#x59CB;&#x5411;-hbase-&#x63D2;&#x5165;&#x6570;&#x636E;">7. &#x542F;&#x52A8;&#x6D88;&#x8D39;&#x8005;, &#x5F00;&#x59CB;&#x5411; HBase &#x63D2;&#x5165;&#x6570;&#x636E;</h2>
<h2 id="8-&#x786E;&#x8BA4;&#x6570;&#x636E;&#x662F;&#x5426;&#x63D2;&#x5165;&#x6210;&#x529F;">8. &#x786E;&#x8BA4;&#x6570;&#x636E;&#x662F;&#x5426;&#x63D2;&#x5165;&#x6210;&#x529F;.</h2>
<hr>
<h2 id="&#x4F7F;&#x7528;&#x914D;&#x7F6E;&#x6587;&#x4EF6;&#x7684;&#x65B9;&#x5F0F;&#x6CE8;&#x518C;&#x534F;&#x5904;&#x7406;&#x5668;">&#x4F7F;&#x7528;&#x914D;&#x7F6E;&#x6587;&#x4EF6;&#x7684;&#x65B9;&#x5F0F;&#x6CE8;&#x518C;&#x534F;&#x5904;&#x7406;&#x5668;</h2>
<p>&#x5728;<code>hbase-site.xml</code>&#x4E0B;&#x6DFB;&#x52A0;&#x5982;&#x4E0B;&#x5C5E;&#x6027;:</p>
<pre class="language-"><code class="lang-xml"><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>property</span><span class="token punctuation">&gt;</span></span>
    <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>name</span><span class="token punctuation">&gt;</span></span>hbase.coprocessor.region.classes<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>name</span><span class="token punctuation">&gt;</span></span>
    <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>value</span><span class="token punctuation">&gt;</span></span>com.atguigu.dataconsumer.coprocessor.CalleeWriteObserver<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>value</span><span class="token punctuation">&gt;</span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>property</span><span class="token punctuation">&gt;</span></span>
</code></pre>
<p>&#x5206;&#x53D1;&#x914D;&#x7F6E;&#x6587;&#x4EF6;, &#x91CD;&#x542F; HBase.</p>
<blockquote>
<h4 id="&#x6CE8;&#x610F;"><em>&#x6CE8;&#x610F;:</em></h4>
</blockquote>
<ol>
<li><p>&#x7531;&#x4E8E;&#x914D;&#x7F6E;&#x6587;&#x4EF6;&#x7684;&#x65B9;&#x5F0F;&#x662F;&#x5BF9;&#x6240;&#x6709;&#x8868;&#x6709;&#x6548;, &#x6240;&#x4EE5;&#x9700;&#x8981;&#x5728;&#x534F;&#x5904;&#x7406;&#x4E2D;&#x5BF9;&#x8868;&#x505A;&#x5224;&#x65AD;, &#x5426;&#x5219;&#x534F;&#x5904;&#x7406;&#x6CA1;&#x6709;&#x529E;&#x6CD5;&#x6B63;&#x5E38;&#x5DE5;&#x4F5C;</p>
</li>
<li><p>&#x4F7F;&#x7528;&#x4E86;&#x914D;&#x7F6E;&#x6587;&#x4EF6;&#x6CE8;&#x518C;, &#x5C31;&#x4E0D;&#x9700;&#x8981;&#x518D;&#x4F7F;&#x7528; API &#x7684;&#x65B9;&#x5F0F;&#x6CE8;&#x518C;&#x6DFB;&#x52A0;&#x4E86;</p>
</li>
<li><p>&#x4E0D;&#x7BA1;&#x54EA;&#x79CD;&#x65B9;&#x5F0F;&#x6DFB;&#x52A0;, &#x90FD;&#x9700;&#x8981;&#x628A; jar &#x5305;&#x653E;&#x5165;<code>$HBASE_HOME/lib</code>&#x76EE;&#x5F55;&#x4E0B;.</p>
</li>
</ol>
<footer class="page-footer"><span class="copyright">Copyright &#xA9; &#x5C1A;&#x7845;&#x8C37;&#x5927;&#x6570;&#x636E; 2019 all right reserved&#xFF0C;powered by Gitbook</span><span class="footer-modification"><br>&#x8BE5;&#x6587;&#x4EF6;&#x6700;&#x540E;&#x4FEE;&#x8BA2;&#x65F6;&#x95F4;&#xFF1A;
2018-12-28 20:58:24
</span></footer>
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="3241-shou-dong-cha-ru-bei-jiao-xin-xi.html" class="navigation navigation-prev " aria-label="Previous page: 3.2.4.1 手动写入被叫信息">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="../325-ba-zheng-ge-xiao-fei-mo-kuai-da-bao-dao-ji-qun-zhong-yun-xing.html" class="navigation navigation-next " aria-label="Next page: 3.2.5 把整个消费模块打包到集群中运行">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"3.2.4.2 使用协处理器写入被叫信息","level":"1.3.2.4.2","depth":4,"next":{"title":"3.2.5 把整个消费模块打包到集群中运行","level":"1.3.2.5","depth":3,"path":"di-3-zhang-xiang-shi-xian/32-shu-ju-cai-ji-he-xiao-fei/325-ba-zheng-ge-xiao-fei-mo-kuai-da-bao-dao-ji-qun-zhong-yun-xing.md","ref":"di-3-zhang-xiang-shi-xian/32-shu-ju-cai-ji-he-xiao-fei/325-ba-zheng-ge-xiao-fei-mo-kuai-da-bao-dao-ji-qun-zhong-yun-xing.md","articles":[]},"previous":{"title":"3.2.4.1 手动写入被叫信息","level":"1.3.2.4.1","depth":4,"path":"di-3-zhang-xiang-shi-xian/32-shu-ju-cai-ji-he-xiao-fei/323-shu-ju-cha-xun-fang-shi-2/3241-shou-dong-cha-ru-bei-jiao-xin-xi.md","ref":"di-3-zhang-xiang-shi-xian/32-shu-ju-cai-ji-he-xiao-fei/323-shu-ju-cha-xun-fang-shi-2/3241-shou-dong-cha-ru-bei-jiao-xin-xi.md","articles":[]},"dir":"ltr"},"config":{"plugins":["splitter","expandable-chapters-small","page-toc-button","-highlight","prism","prism-themes","tbfed-pagefooter","sitemap","change_girls","livereload"],"styles":{"website":"styles/website.css","ebook":"styles/ebook.css","pdf":"styles/pdf.css","mobi":"styles/mobi.css","epub":"styles/epub.css"},"pluginsConfig":{"tbfed-pagefooter":{"copyright":"Copyright &copy 尚硅谷大数据 2019","modify_label":"<br>该文件最后修订时间：","modify_format":"YYYY-MM-DD HH:mm:ss"},"prism":{"css":["prismjs/themes/prism-solarizedlight.css"]},"disqus":{"shortName":"zhenchao125"},"livereload":{},"splitter":{},"change_girls":{"time":30,"urls":["http://lizhenchao.oss-cn-shenzhen.aliyuncs.com/imgs/18-3-4/62171757.jpg-atguiguImg","http://lizhenchao.oss-cn-shenzhen.aliyuncs.com/imgs/18-3-4/83394736.jpg-atguiguImg","http://lizhenchao.oss-cn-shenzhen.aliyuncs.com/imgs/18-3-4/15906185.jpg-atguiguImg","http://lizhenchao.oss-cn-shenzhen.aliyuncs.com/imgs/18-3-4/15906185.jpg-atguiguImg","http://lizhenchao.oss-cn-shenzhen.aliyuncs.com/imgs/18-3-4/3394270.jpg-atguiguImg","http://lizhenchao.oss-cn-shenzhen.aliyuncs.com/imgs/18-3-4/65028582.jpg-atguiguImg","http://lizhenchao.oss-cn-shenzhen.aliyuncs.com/imgs/18-3-4/20359261.jpg-atguiguImg","http://lizhenchao.oss-cn-shenzhen.aliyuncs.com/imgs/18-3-4/37472401.jpg-atguiguImg","http://lizhenchao.oss-cn-shenzhen.aliyuncs.com/imgs/18-3-4/3355397.jpg-atguiguImg","http://lizhenchao.oss-cn-shenzhen.aliyuncs.com/imgs/18-3-4/11075549.jpg-atguiguImg"]},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"sitemap":{"hostname":"http://bigdataatguigu.applinzi.com/"},"page-toc-button":{"maxTocDepth":3,"minTocSize":2},"prism-themes":{},"expandable-chapters-small":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","author":" 李振超","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"大数据 bigdata_telecom_project_atguigu 课堂笔记","language":"zh-hans","links":{"sidebar":{"联系我们":"http://www.atguigu.com/"}},"gitbook":"*","description":"课堂笔记,学生提前预习"},"file":{"path":"di-3-zhang-xiang-shi-xian/32-shu-ju-cai-ji-he-xiao-fei/323-shu-ju-cha-xun-fang-shi-2/3242-shi-yong-xie-chu-li-qi-xie-ru-bei-jiao-xin-xi.md","mtime":"2018-12-28T12:58:24.075Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2019-09-11T00:27:37.149Z"},"basePath":"../../..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../../../gitbook/gitbook.js"></script>
    <script src="../../../gitbook/theme.js"></script>
    
        
        <script src="../../../gitbook/gitbook-plugin-splitter/splitter.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-expandable-chapters-small/expandable-chapters-small.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-page-toc-button/plugin.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-change_girls/girls.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

